/* bsound.c */

#include "map.h"
#include "bsound.h"

#include "DeskLib:Error.h"

int SoundChannels = 8;

int bsound_stereotab[MAPSIZEX];

int sound_channel = 0;

void bsound_initialise()
{
  int x;
  for (x = 0; x < MAPSIZEX; ++x)
    bsound_stereotab[x] = (256 * x) / MAPSIZEX - 127;
}

static int channel_count;
static int sample_size;
static int sample_period;
static void *channel_handler;
static void *scheduler;

void init_sound()
{
  Error_Check(xsound_configure(SoundChannels, 208, 48, 0, 0,
  	&channel_count, &sample_size, &sample_period,
  	&channel_handler, &scheduler));
}

void reset_sound()
{
  xsound_configure(channel_count, sample_size, sample_period,
  	channel_handler, scheduler,
  	&channel_count, &sample_size, &sample_period,
  	&channel_handler, &scheduler);
}
